package com.ywps.vaas.framework.util

import com.ywps.vaas.framework.conf.ConfigTools
import com.ywps.vaas.framework.constant.PropertiesConstant

import java.util.Properties

object JdbcUtil {

  val properties: Properties = ConfigTools.getPropertiesFactory()

  def getConf(): Properties ={
    val ConnProperties = new Properties();
    ConnProperties.put(PropertiesConstant.MYSQL_POOL_JDBC_DRIVERCLASS_NAME, properties.getProperty(PropertiesConstant.MYSQL_POOL_JDBC_DRIVERCLASS));
    ConnProperties.put(PropertiesConstant.MYSQL_POOL_JDBC_USERNAME_NAME, properties.getProperty(PropertiesConstant.MYSQL_POOL_JDBC_USERNAME));
    ConnProperties.put(PropertiesConstant.MYSQL_POOL_JDBC_PASSWORD_NAME, properties.getProperty(PropertiesConstant.MYSQL_POOL_JDBC_PASSWORD));
    //读取条数限制
    ConnProperties.put(PropertiesConstant.MYSQL_POOL_JDBC_FETCHSIZE_NAME, PropertiesConstant.MYSQL_POOL_JDBC_FETCHSIZE);
    //写入条数限制
    ConnProperties.put(PropertiesConstant.MYSQL_POOL_JDBC_BATCHSIZE_NAME, PropertiesConstant.MYSQL_POOL_JDBC_BATCHSIZE);
    return ConnProperties;
  }

  def getUrl():String ={
    properties.getProperty(PropertiesConstant.MYSQL_POOL_JDBC_URL)
  }

}
